#pragma once
#pragma once
#include "DXAMLCommon.h"
#include "IError.h"
class CErrorEventArg;
class CErrorEventArgs;

class CError :
	public IError
{

public: 
	static HRESULT Create(enum ErrorType eType, XUINT32 iErrorCode, XBOOL bRecoverable, XUINT32 uLineNumber, XUINT32 uCharPosition, struct XSTRING * * ppParam, XUINT32 cParams, struct IError * * ppError, struct IErrorService * pErrorService);

protected: 
	CError(enum ErrorType eType, XUINT32 iErrorCode, XBOOL bRecoverable, XUINT32 uLineNumber, XUINT32 uCharPosition, struct IErrorService * pErrorService);
	virtual ~CError();
	virtual HRESULT Initialize(XUINT32 iErrorCode, struct XSTRING * * ppParam, XUINT32 cParams);
public: 
	virtual XUINT32 AddRef();
	virtual XUINT32 Release();
	virtual void SetErrorEventSender(struct IDependencyObject * pSender);
	virtual HRESULT GetErrorEventSender(struct IDependencyObject * * ppSender);
	virtual HRESULT SetErrorEventArgs(struct IDependencyObject * pErrorEventArgs);
	virtual HRESULT GenerateErrorEventArgs(CErrorEventArgs * * ppErrorEventArgs, struct ICoreServices * pCore);
	virtual HRESULT GetErrorMessage(XUINT32 * pcMessage, XUINT16 * * ppErrorMessage);
	virtual enum ErrorType GetErrorType();
	virtual XUINT32 GetErrorCode();
	virtual HRESULT GetErrorResult();
	virtual XUINT32 GetLineNumber();
	virtual XUINT32 GetCharPosition();
	virtual XBOOL GetIsRecoverable();
	virtual HRESULT SetErrorMessage(XUINT32 cMessage, XUINT16 * pErrorMessage);
	void SetErrorCode(XUINT32 iErrorCode, struct XSTRING * * ppParam, XUINT32 cParams);
	void SetErrorResult(HRESULT hrErr, struct XSTRING * * ppParam, XUINT32 cParams);
	virtual XBOOL SetIsRecoverable(XBOOL bIsRecoverable);
	enum ErrorType m_eType;
	XUINT32 m_iErrorCode;
	XBOOL m_bRecoverable;
	XUINT32 m_uLineNumber;
	XUINT32 m_uCharPosition;
	HRESULT m_hrErr;
	CXString * m_pstrErrorDescription;
	XUINT32 m_cRef;
protected: 
	struct IDependencyObject * m_pSender; 
	struct IPALCriticalSection * m_pCSError;
	struct IErrorService * m_pErrorService;
};


